<template>
  <el-date-picker v-model="dateRange" type="daterange" value-format="YYYY-MM-DD" start-placeholder="开始日期"
    end-placeholder="结束日期" />
</template>

<script setup>

const start = defineModel('start', { type: String,  })
const end = defineModel('end', { type: String,  })


const dateRange = computed({
  get: () => start.value?[start.value, end.value]:null,
  set: (newValue) => {
    start.value = newValue?newValue[0]:null
    end.value = newValue?newValue[1]:null
  }
})

watch([start, end], () => {
  dateRange.value = [start.value, end.value]
})
</script>

<style lang="scss" scoped>
</style>
